package com.su.lesson01;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class testFlowLayout {
    public static void main(String[] args) {
        Frame frame = new Frame("流式布局");
        //设置按钮
        Button button1 = new Button("button-1");
        Button button2 = new Button("button-2");
        Button button3 = new Button("button-3");

        //设置流式布局
        frame.setLayout(new FlowLayout());
        frame.add(button1, FlowLayout.LEFT);
        frame.add(button2, FlowLayout.CENTER);
        frame.add(button3, FlowLayout.RIGHT);

        //设置弹窗大小位置
        frame.setBounds(200, 200, 300, 300);
        frame.setVisible(true);//弹窗可见
        frame.setResizable(false);

        //弹窗监听关闭程序
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
